<template>
	<view>
		<van-cell :title="item.goods_name" v-for="(item,index) in search" :key="index" @click="go(item.goods_id)" />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				search:[]
			};
		},
		methods:{
			async getList(word){
				let {data:res} = await uni.$http.get('/api/public/v1/goods/qsearch?query='+word)
				console.log(res,'search')
				this.search = res.message
			},
			go(id){
				wx.navigateTo({
					url:'/sub/detail/detail?id='+id
				})
			}
		},
		onLoad(e) {
			console.log(e,'e')
			this.getList(e.word)
		}
	}
</script>

<style lang="scss">

</style>
